/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Clases;

import java.io.Serializable;
import javax.persistence.*;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author PaBLo
 */
@Entity
@Table(name = "alumnonota")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Alumnonota.findAll", query = "SELECT a FROM Alumnonota a"),
    @NamedQuery(name = "Alumnonota.findByIdAlumno", query = "SELECT a FROM Alumnonota a WHERE a.alumnonotaPK.idAlumno = :idAlumno"),
    @NamedQuery(name = "Alumnonota.findByIdNota", query = "SELECT a FROM Alumnonota a WHERE a.alumnonotaPK.idNota = :idNota"),
    @NamedQuery(name = "Alumnonota.findByNotaObtenidaNeta", query = "SELECT a FROM Alumnonota a WHERE a.notaObtenidaNeta = :notaObtenidaNeta"),
    @NamedQuery(name = "Alumnonota.findByNotaObtenidaPorcentual", query = "SELECT a FROM Alumnonota a WHERE a.notaObtenidaPorcentual = :notaObtenidaPorcentual"),
    @NamedQuery(name = "Alumnonota.findByApuntes", query = "SELECT a FROM Alumnonota a WHERE a.apuntes = :apuntes")})
public class Alumnonota implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected AlumnonotaPK alumnonotaPK;
    @Basic(optional = false)
    @Column(name = "NotaObtenidaNeta")
    private String notaObtenidaNeta;
    @Basic(optional = false)
    @Column(name = "NotaObtenidaPorcentual")
    private String notaObtenidaPorcentual;
    @Column(name = "Apuntes")
    private String apuntes;
    @JoinColumn(name = "idNota", referencedColumnName = "idNota", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Nota nota;
    @JoinColumn(name = "idAlumno", referencedColumnName = "idAlumno", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private Alumno alumno;

    public Alumnonota() {
    }

    public Alumnonota(AlumnonotaPK alumnonotaPK) {
        this.alumnonotaPK = alumnonotaPK;
    }

    public Alumnonota(AlumnonotaPK alumnonotaPK, String notaObtenidaNeta, String notaObtenidaPorcentual) {
        this.alumnonotaPK = alumnonotaPK;
        this.notaObtenidaNeta = notaObtenidaNeta;
        this.notaObtenidaPorcentual = notaObtenidaPorcentual;
    }

    public Alumnonota(short idAlumno, short idNota) {
        this.alumnonotaPK = new AlumnonotaPK(idAlumno, idNota);
    }

    public AlumnonotaPK getAlumnonotaPK() {
        return alumnonotaPK;
    }

    public void setAlumnonotaPK(AlumnonotaPK alumnonotaPK) {
        this.alumnonotaPK = alumnonotaPK;
    }

    public String getNotaObtenidaNeta() {
        return notaObtenidaNeta;
    }

    public void setNotaObtenidaNeta(String notaObtenidaNeta) {
        this.notaObtenidaNeta = notaObtenidaNeta;
    }

    public String getNotaObtenidaPorcentual() {
        return notaObtenidaPorcentual;
    }

    public void setNotaObtenidaPorcentual(String notaObtenidaPorcentual) {
        this.notaObtenidaPorcentual = notaObtenidaPorcentual;
    }

    public String getApuntes() {
        return apuntes;
    }

    public void setApuntes(String apuntes) {
        this.apuntes = apuntes;
    }

    public Nota getNota() {
        return nota;
    }

    public void setNota(Nota nota) {
        this.nota = nota;
    }

    public Alumno getAlumno() {
        return alumno;
    }

    public void setAlumno(Alumno alumno) {
        this.alumno = alumno;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (alumnonotaPK != null ? alumnonotaPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Alumnonota)) {
            return false;
        }
        Alumnonota other = (Alumnonota) object;
        if ((this.alumnonotaPK == null && other.alumnonotaPK != null) || (this.alumnonotaPK != null && !this.alumnonotaPK.equals(other.alumnonotaPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Clases.Alumnonota[ alumnonotaPK=" + alumnonotaPK + " ]";
    }
    
}
